<?php


namespace app\api\controller\v1;
use app\api\validate\PageSize;
use app\api\model\Product as ProductModel;
use app\lib\exception\ProductException;

class Product
{
    public function getRecent($pageSize = 15) {
        (new PageSize()) -> goCheck();
        $result = ProductModel::getMostRecent($pageSize);
        if (!$result) {
            throw new ProductException();
        }
        return json($result);
    }


}